<html>
<head><meta charset="utf-8"><title>ERA series · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html">ERA series</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="246260958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/246260958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#246260958">(Jul 16 2021 at 18:24)</a>:</h4>
<p>Hey, I've recorded a couple of "real" explaining rust-analyzer videos!</p>



<a name="246261248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/246261248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#246261248">(Jul 16 2021 at 18:27)</a>:</h4>
<p>Here's the playlist: <a href="https://www.youtube.com/playlist?list=PLhb66M_x9UmrqXhQuIpWC5VgTdrGxMx3y">https://www.youtube.com/playlist?list=PLhb66M_x9UmrqXhQuIpWC5VgTdrGxMx3y</a></p>
<p>First two videos are:</p>
<ul>
<li><a href="https://www.youtube.com/watch?v=I3RXottNwk0&amp;list=PLhb66M_x9UmrqXhQuIpWC5VgTdrGxMx3y">overview</a><div class="youtube-video message_inline_image"><a data-id="I3RXottNwk0" href="https://www.youtube.com/watch?v=I3RXottNwk0&amp;list=PLhb66M_x9UmrqXhQuIpWC5VgTdrGxMx3y"><img src="https://uploads.zulipusercontent.net/7f9d3cdaa9eeee980c487335df26800eca0b1e9c/68747470733a2f2f692e7974696d672e636f6d2f76692f493352586f74744e776b302f64656661756c742e6a7067"></a></div></li>
<li><a href="https://www.youtube.com/watch?v=SaSULKoSlWI&amp;list=PLhb66M_x9UmrqXhQuIpWC5VgTdrGxMx3y">vfs</a><div class="youtube-video message_inline_image"><a data-id="SaSULKoSlWI" href="https://www.youtube.com/watch?v=SaSULKoSlWI&amp;list=PLhb66M_x9UmrqXhQuIpWC5VgTdrGxMx3y"><img src="https://uploads.zulipusercontent.net/956c71ab01d5d52cb23aa5ddde20ddff0334fe02/68747470733a2f2f692e7974696d672e636f6d2f76692f536153554c4b6f536c57492f64656661756c742e6a7067"></a></div></li>
</ul>



<a name="246279894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/246279894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#246279894">(Jul 16 2021 at 21:08)</a>:</h4>
<p>I wonder how long that playlist will be in hours in the end given how big RA is <span aria-label="big smile" class="emoji emoji-1f604" role="img" title="big smile">:big_smile:</span></p>



<a name="246379402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/246379402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#246379402">(Jul 18 2021 at 13:41)</a>:</h4>
<p>New video: the IDE crate: <a href="https://www.youtube.com/watch?v=5l31PsZJ2Cc">https://www.youtube.com/watch?v=5l31PsZJ2Cc</a></p>
<div class="youtube-video message_inline_image"><a data-id="5l31PsZJ2Cc" href="https://www.youtube.com/watch?v=5l31PsZJ2Cc"><img src="https://uploads.zulipusercontent.net/6c31b67d587f5ca08e4cc871b2b089892b1c4196/68747470733a2f2f692e7974696d672e636f6d2f76692f356c333150735a4a3243632f64656661756c742e6a7067"></a></div>



<a name="246381034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/246381034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#246381034">(Jul 18 2021 at 14:17)</a>:</h4>
<p>I really like your desktop background.</p>



<a name="246510133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/246510133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#246510133">(Jul 19 2021 at 20:33)</a>:</h4>
<p>New video: the main loop: <a href="https://www.youtube.com/watch?v=bfE_ZVDLHmo">https://www.youtube.com/watch?v=bfE_ZVDLHmo</a></p>
<div class="youtube-video message_inline_image"><a data-id="bfE_ZVDLHmo" href="https://www.youtube.com/watch?v=bfE_ZVDLHmo"><img src="https://uploads.zulipusercontent.net/d5dccd2a3c86941894788ab6f0ab6fc1f608270b/68747470733a2f2f692e7974696d672e636f6d2f76692f6266455f5a56444c486d6f2f64656661756c742e6a7067"></a></div>



<a name="246643851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/246643851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#246643851">(Jul 20 2021 at 20:18)</a>:</h4>
<p>Next video: the crate graph: <a href="https://www.youtube.com/watch?v=STiKE1ES2fQ">https://www.youtube.com/watch?v=STiKE1ES2fQ</a></p>
<div class="youtube-video message_inline_image"><a data-id="STiKE1ES2fQ" href="https://www.youtube.com/watch?v=STiKE1ES2fQ"><img src="https://uploads.zulipusercontent.net/251aa2ef7382a08c3d25225ab91e5cc1394cca35/68747470733a2f2f692e7974696d672e636f6d2f76692f5354694b453145533266512f64656661756c742e6a7067"></a></div>



<a name="246763430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/246763430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mahdi Faramarzpour <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#246763430">(Jul 21 2021 at 18:58)</a>:</h4>
<p>I've been watching this series for a while.I'd like to know if it makes sense to share my own notes from the videos with others. These notes are my own interpretation of the content and include a summary of the important points in the video.</p>



<a name="246833673"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/246833673" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#246833673">(Jul 22 2021 at 11:15)</a>:</h4>
<p><span class="user-mention" data-user-id="424024">@Mahdi Faramarzpour</span> most definitely! I bet it'll be useful to someone!</p>



<a name="246834554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/246834554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mahdi Faramarzpour <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#246834554">(Jul 22 2021 at 11:28)</a>:</h4>
<p>So how should I do that?<br>
I can prepare them as .md files, but where should I post them?</p>



<a name="246834611"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/246834611" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#246834611">(Jul 22 2021 at 11:30)</a>:</h4>
<p>I suggest using this stream as a point of coordination. </p>
<p>I guess, keeping them in some kind of a repo might be smart as well -- maybe other folks would want to expand on notes</p>



<a name="246849271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/246849271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mahdi Faramarzpour <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#246849271">(Jul 22 2021 at 13:51)</a>:</h4>
<p><a href="https://github.com/mahdi-frms/rust-analyzer-notes">https://github.com/mahdi-frms/rust-analyzer-notes</a></p>



<a name="247023928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247023928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247023928">(Jul 23 2021 at 19:52)</a>:</h4>
<p>Next video: the base database: <a href="https://youtu.be/m1EXCpIHSKA">https://youtu.be/m1EXCpIHSKA</a></p>
<div class="youtube-video message_inline_image"><a data-id="m1EXCpIHSKA" href="https://youtu.be/m1EXCpIHSKA"><img src="https://uploads.zulipusercontent.net/5699aeb43f67ce1a8511dcc1b92a85e3b8fa9a3a/68747470733a2f2f692e7974696d672e636f6d2f76692f6d31455843704948534b412f64656661756c742e6a7067"></a></div>



<a name="247024801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247024801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247024801">(Jul 23 2021 at 20:00)</a>:</h4>
<p>27:00 it's embarrassing when your software is so fast that you can't even show that big-O algorithmic improvement leads to faster code.</p>



<a name="247346004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247346004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mahdi Faramarzpour <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247346004">(Jul 27 2021 at 15:06)</a>:</h4>
<p>I've got a question about VFS lecture...<br>
Three reasons were provided in this video for using a vfs rather than the OS filesystem, one being the repeatable read property.<br>
The idea is, Rust Analyzer needs more memory than a compiler. For that, it tends to forget about the derived data.<br>
So I open a file in a library crate for a 'go to definition', and close it. Thus, RA parses it but when I closed the file, RA forgot about the parsing result. Now it was said that if we rely on OS filesystem and we want to get back that derived data, the file might have changed and we'll get inconsistency, which is something I do not get really. What sort of inconsistency? If it has really changed, why do we need that old derived data?</p>



<a name="247347076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247347076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247347076">(Jul 27 2021 at 15:14)</a>:</h4>
<p>Here's a semi-hypothetical example:</p>
<p>Let's say that file contained a <code>pub struct Foo</code> at line 92. When parsing the file, rust-analyzer will store the fact that there's an entity with name <code>Foo</code> at that line in the index of all names. But, to same memory, it wouldn't store it visibility</p>
<p>Now, let's say you invoke "workspace symbol" functionality, and give <code>Foo</code> as a query. You ask the index about known <code>Foo</code>s and get that one from stdlib back. When displaying results to the user, you want to learn about visibility (to, eg, show a different icon). You then fetch the next of the file, and go to the line 92. This is the point where you need this line to still contain the <code>Foo</code> struct. </p>
<p>In other words, if we forgot <em>everything</em>, then, yeah, this wouldn't be a problem. However we forget only partially -- we hang onto some derived stuff. And that derived data might become inconsistent.</p>



<a name="247347383"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247347383" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247347383">(Jul 27 2021 at 15:16)</a>:</h4>
<p>Maybe it's this scenario:</p>
<ul>
<li>we're computing a query on file A</li>
<li>for that, we need to run a query on file B</li>
<li>we drop some information about file A here</li>
<li>for the query on B we need to run a query on A</li>
<li>A changes on disk</li>
<li>we re-read and, but have an inconsistent view of what's in A</li>
</ul>



<a name="247347474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247347474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247347474">(Jul 27 2021 at 15:16)</a>:</h4>
<p>To give a real-life example of this, we generally identify symbols by their positions: "function <code>foo</code> is the third item in this file".  We used to have a bug where we didn't persist the results of proc macros. And there was a procc macro, whose output dependend on hash-map iteration order, and thus it generated items in different oreded with different runs.</p>
<p>So it happened that we looked at the expansion of this macro, marked that we have a function at the third position, then forgot the expansion, then re-calculated expansion (when, eg, we decided to look at the fn body), but there weren't a function at that position</p>



<a name="247347587"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247347587" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247347587">(Jul 27 2021 at 15:17)</a>:</h4>
<p>So we got a panic for this unwrap:</p>
<p><a href="https://github.com/rust-analyzer/rust-analyzer/blob/3a59b56324db99475ea2027cb94f82785b16ad14/crates/hir_expand/src/ast_id_map.rs#L112">https://github.com/rust-analyzer/rust-analyzer/blob/3a59b56324db99475ea2027cb94f82785b16ad14/crates/hir_expand/src/ast_id_map.rs#L112</a></p>



<a name="247348595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247348595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mahdi Faramarzpour <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247348595">(Jul 27 2021 at 15:25)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span> <span class="user-mention" data-user-id="203546">@Laurențiu</span>  thanks for the answers.<br>
So that's generally because we partially forget, not totally.</p>



<a name="247349000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247349000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247349000">(Jul 27 2021 at 15:28)</a>:</h4>
<p>We had an issue for compressing the source code (<a href="https://github.com/rust-analyzer/rust-analyzer/issues/869">https://github.com/rust-analyzer/rust-analyzer/issues/869</a>), but I'm not sure what I measured there :(</p>



<a name="247349035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247349035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247349035">(Jul 27 2021 at 15:29)</a>:</h4>
<p>We're at 638 MB RSS today, despite probably having more code</p>



<a name="247382213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247382213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247382213">(Jul 27 2021 at 19:51)</a>:</h4>
<p>Next video: syntax overview <a href="https://youtu.be/8jryEJRnPfU">https://youtu.be/8jryEJRnPfU</a></p>
<div class="youtube-video message_inline_image"><a data-id="8jryEJRnPfU" href="https://youtu.be/8jryEJRnPfU"><img src="https://uploads.zulipusercontent.net/2a25b9e31877881fb8532b71406ef479c2e8ba64/68747470733a2f2f692e7974696d672e636f6d2f76692f386a7279454a526e5066552f64656661756c742e6a7067"></a></div>



<a name="247783529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247783529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mahdi Faramarzpour <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247783529">(Jul 31 2021 at 03:49)</a>:</h4>
<p>I'm not getting the actual difference between a crate, FileSet and SourceRoot:</p>
<ul>
<li>I think SourceRoot is just a FileSet with a boolean flag, right?</li>
<li>Each file belongs to only one FileSet, thus one SourceRoot, right?</li>
<li>I thought crates have a one-to-one relation with FileSet/SourceRoots, is that true?</li>
</ul>
<p>by crate I mean the nodes in CrateGraph.</p>



<a name="247791189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247791189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247791189">(Jul 31 2021 at 07:27)</a>:</h4>
<p>1&amp;2 are correct, 3 is not: a single source root can host many crates</p>



<a name="247791252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247791252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247791252">(Jul 31 2021 at 07:28)</a>:</h4>
<p>in particular, a single cargo package (directory with Cargo.toml) is a single source root, but it contains many crates -- </p>
<ul>
<li>src/lib.rs crate</li>
<li>src/lib.rs  with <code>--test</code> crate</li>
<li>src/bin/* crates</li>
<li>examples/* crates</li>
<li>tests/* crates</li>
</ul>



<a name="247793262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247793262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mahdi Faramarzpour <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247793262">(Jul 31 2021 at 08:24)</a>:</h4>
<p>So, what if I open a whole cargo workspace? (like RA source directory) then all of that becomes one SourceRoot or each package becomes a SourceRoot?</p>



<a name="247794498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247794498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247794498">(Jul 31 2021 at 08:59)</a>:</h4>
<p>eachc packeage becomes a source root</p>



<a name="247794561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247794561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247794561">(Jul 31 2021 at 09:00)</a>:</h4>
<p>and I think for sysroot (libstd, libcore and their deps) we use a single source root</p>



<a name="247794670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247794670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mahdi Faramarzpour <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247794670">(Jul 31 2021 at 09:03)</a>:</h4>
<p>Got it now, thanks.</p>



<a name="247892079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247892079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mahdi Faramarzpour <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247892079">(Aug 02 2021 at 04:22)</a>:</h4>
<p>question about the base db lecture:<br>
what is the <code>SourceDatabaseExt</code> exposing that the <code>FileLoader</code>is not doing so?</p>



<a name="247902230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247902230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247902230">(Aug 02 2021 at 09:05)</a>:</h4>
<p><code>fn source_root(&amp;self, id: SourceRootId) -&gt; Arc&lt;SourceRoot&gt;</code></p>
<p>With SdbExt, you can get a list of files in the same source root at the current file. It let's you discover files without knowing their paths. </p>
<p>In file loader, the only way to get a new file is <code>fn resolve_path(&amp;self, path: AnchoredPath) -&gt; Option&lt;FileId&gt;;</code>, where AnchoredPath is a pair of <code>FileId</code> and  a utf8 path. That is,  to get a FileId, you need to know its path first.</p>



<a name="247904030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247904030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mahdi Faramarzpour <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247904030">(Aug 02 2021 at 09:37)</a>:</h4>
<p>My real problem is that I sort of don't understand how you're using the whole thing <span aria-label="grimacing" class="emoji emoji-1f62c" role="img" title="grimacing">:grimacing:</span> <br>
Maybe I should see how Salsa and RootDatabase work.</p>



<a name="247905228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/247905228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mahdi Faramarzpour <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#247905228">(Aug 02 2021 at 09:56)</a>:</h4>
<p>BTW I think that would be good to cover RootDatabase and it's API in the next videos.</p>



<a name="248626775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/ERA%20series/near/248626775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/ERA.20series.html#248626775">(Aug 06 2021 at 15:39)</a>:</h4>
<p>Next video: got carried away and started implementing rowan from scratch: <a href="https://youtu.be/n5LDjWIAByM">https://youtu.be/n5LDjWIAByM</a></p>
<div class="youtube-video message_inline_image"><a data-id="n5LDjWIAByM" href="https://youtu.be/n5LDjWIAByM"><img src="https://uploads.zulipusercontent.net/49e1bd0222b62e2a198c39fea35aab8ef1f7802d/68747470733a2f2f692e7974696d672e636f6d2f76692f6e354c446a57494142794d2f64656661756c742e6a7067"></a></div>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>